import {createRouter, createWebHashHistory, RouteRecordRaw} from 'vue-router'
import beforeEach from "./baforeEach";
// import layout from '@/components/layout/layout.vue';
import home from "@/views/home.vue"

export const routes: Array<RouteRecordRaw> = [
    {
        path: "/",
        redirect: "/login"
    },
    {
        path: "/home",
        component: home,
        name: "home",
        children: []
    },
    {
        path: '/login',
        component: () => import("@/views/system/login.vue"),
        name: 'login',
        meta: {
            noAuth:true
        }
    },
    {
        path: '/register',
        component: () => import("@/views/system/register.vue"),
        name: 'register',
        meta:{
            noAuth: true
        }
    },
];
const router = createRouter({
    history: createWebHashHistory(),
    routes: routes,
})


//路由拦截器
router.beforeEach((to, from, next) => {
    beforeEach(to, from, next)
})

export default router